//
//  WD_RootViewController.m
//  mhkjjsd
//
//  Created by 凤利史 on 2018/5/22.
//  Copyright © 2018年 sunrose. All rights reserved.
//

#import "WD_RootViewController.h"
#import "WD_RootOneTableViewCell.h"
#import "WD_RootTwoTableViewCell.h"
#import "WD_RootThreeTableViewCell.h"

@interface WD_RootViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *dataArr;

@end

@implementation WD_RootViewController
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    
    [self.navigationController setNavigationBarHidden:YES animated:NO];
    
    
}
- (void)viewDidLoad {
    
    [super viewDidLoad];
    [self creationView];
    [self regeditCell];
    // Do any additional setup after loading the view.
}
- (void)creationView{
    
    UILabel *titleLabel = [[UILabel alloc] init];
    [self.view addSubview:titleLabel];
    titleLabel.text = @"我的";
    titleLabel.textColor = getColor(@"333333");
    titleLabel.font = [UIFont fontWithName:@"DINEngschrift LT Alternate" size:17];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).with.offset(15);
        make.top.equalTo(self.view).with.offset((KIsiPhoneX?24:0)+20);
        
    }];
    self.tableView = [[UITableView alloc] init];
    self.tableView.frame = CGRectMake(0, (KIsiPhoneX?79:55), DEF_SCREEN_WIDTH, DEF_SCREEN_HEIGHT - (KIsiPhoneX?79:55));
    
    self.tableView.tableFooterView = [[UITableView alloc] initWithFrame:CGRectZero];
    
    self.tableView.backgroundColor = getColor(@"F5F7FA");
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.view addSubview:self.tableView];
    
}

- (void)regeditCell{
    
    
    
    [self.tableView registerNib:[UINib nibWithNibName:@"WD_RootOneTableViewCell" bundle:nil] forCellReuseIdentifier:@"WD_RootOneTableViewCell"];
    [self.tableView registerNib:[UINib nibWithNibName:@"WD_RootTwoTableViewCell" bundle:nil] forCellReuseIdentifier:@"WD_RootTwoTableViewCell"];
    [self.tableView registerNib:[UINib nibWithNibName:@"WD_RootThreeTableViewCell" bundle:nil] forCellReuseIdentifier:@"WD_RootThreeTableViewCell"];
    
}

#pragma mark - ---------- Section的数量 ----------
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 3;
}

#pragma mark - ---------- 每个Section的高度 ----------
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0;
}

#pragma mark - ---------- Cell的数量 ----------
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 2) {
        return 5;
    }else{
        return 1;
    }
    
    
}

#pragma mark - ---------- 每个Cell的高度 ----------
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    if (indexPath.section == 0) {
        return 95;
    }else if (indexPath.section == 1){
        return 90;
    }else{
        
        return 55;
        
    }
    
}
#pragma mark - ---------- 每个Cell的内容 ----------
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
        WD_RootOneTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"WD_RootOneTableViewCell" forIndexPath:indexPath];
        
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        
        
        return cell;
    }else if (indexPath.section == 1){
        
        WD_RootTwoTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"WD_RootTwoTableViewCell" forIndexPath:indexPath];
        
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        
        
        return cell;
    }else {
        
        WD_RootThreeTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"WD_RootThreeTableViewCell" forIndexPath:indexPath];
        
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        
        
        return cell;
    }
    
    
    
}

#pragma mark - ---------- 每个Cell的点击事件 ----------
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end

